//
//  TTMusicPlayBottomCollectionViewCell.m
//  TTMusic
//
//  Created by yanghuiyan on 16/4/7.
//  Copyright © 2016年 cpy. All rights reserved.
//

#import "TTMusicPlayBottomCollectionViewCell.h"

@implementation TTMusicPlayBottomCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
      
        self.personImage = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 40, 40)];
        _personImage.layer.masksToBounds = YES;
        _personImage.layer.cornerRadius = 20;
        self.songLabel = [[TTMusicBaseLabel alloc] initWithFrame:CGRectMake(self.personImage.frame.size.width + self.personImage.frame.origin.x + 10, 5, 180, 20)];
        self.singerLabel = [[TTMusicBaseLabel alloc] initWithFrame:CGRectMake(self.songLabel.frame.origin.x, 10 + self.songLabel.frame.size.height, 150, 15)];
        
        self.songLabel = [[TTMusicBaseLabel alloc] initWithFrame:CGRectMake(self.personImage.frame.size.width + self.personImage.frame.origin.x + 10, 5, 180, 20)];
        self.singerLabel = [[TTMusicBaseLabel alloc] initWithFrame:CGRectMake(self.songLabel.frame.origin.x, 10 + self.songLabel.frame.size.height, 150, 15)];
        self.circleView = [[CPYCircleView alloc] initWithFrame:_personImage.frame];

        [self.personImage addSubview:_circleView];
        [self.contentView addSubview:_personImage];
        [self.contentView addSubview:_songLabel];
        [self.contentView addSubview:_singerLabel];
        
    }
    return self;
}
- (void)setSongListModel:(CPYDiscoveryPageSongListModel *)songListModel {
    _songListModel = songListModel;
    _singerLabel.text = songListModel.singerName;
    _songLabel.text = songListModel.name;
    [_personImage sd_setImageWithURL:[NSURL URLWithString:songListModel.picUrl]];
}
-(void)setPlayPercent:(CGFloat)playPercent{
    _playPercent = playPercent;
    
    self.circleView.drawRad = -M_PI_2 + playPercent*2*M_PI;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
